define(['app'], function(app) {
	'use strict';

	//实例化方法
	var factory = function(Http) {
		function get_data_friendList(result) {
			if(false) {
				result = '{"success": true,"msg": "","result": {"store": [' +
					'{"store_id": "001","name": "世达","mobile": "18912345678","region": [' +
					'{"id": "001","name": "世达001"},' +
					'{"id": "002","name": "世达002"}]},' +
					'{"member_id": "002","name": "博士","mobile": "18912345678","region": [' +
					'{"id": "001","name": "博士001"},' +
					'{"id": "002","name": "博士002"}]}]},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
					return JSON.parse(result);
			}else{
				return result;
			}
		};
		function get_data_delete(result) {
			if(false) {
				result = '{"success": true,"msg": "","result": {"store_id": "001"},"session": "7311da98bd0f18eb15a96bcb263f4153"}';
				return JSON.parse(result);
			}else{
				return result;
			}
		}
		
		//返回信息
		return {
			//获取好友列表
			get_friend_list: function(nPage,callback,calldone) {
				Http.post({
					method: 'member.friends.storelist',
					pagelimit: 10,
					nPage: nPage
				}, function(result) {
					if(callback)
						callback(get_data_friendList(result).result);
				}, function(e) {

				}, function() {
					if(calldone)
						calldone();
				})
			},
			//删除
			deleteStore: function(store_id, callback) {
				Http.post({
					method: 'member.friends.delete',
					store_id: store_id,
					member_id: ''
				}, function(result) {
					if(callback)
						callback(get_data_delete(result));
				}, function(e) {

				}, function() {

				})
			}

		};
	}

	factory.$inject = ['Http'];
	return app.registerService("Myfriendjxs", factory);
});